package cz.apnetis.fitweb.shared.dto;

import java.util.Date;

import com.google.gwt.user.client.rpc.IsSerializable;

import cz.apnetis.fitweb.shared.Food;

public class FoodDTO implements Food, IsSerializable {

  private String id; @Override public String getId() { return id; } public void setId(String newId) { id = newId; }
  private String userId; @Override public String getUserId() { return userId; } public void setUserId(String newUserId) { userId = newUserId; }
  private String name; @Override public String getName() { return name; } @Override public void setName(String newName) { this.name = newName; }
  private String ingredientOverview; @Override public String getIngredientOverview() { return ingredientOverview; } @Override public void setIngredientOverview(String newIngredientOverview) { this.ingredientOverview = newIngredientOverview; }
  private Integer kj; @Override public Integer getKj() { return this.kj; } @Override public void setKj(Integer newKj) { this.kj = newKj; }
  private Date time; @Override public Date getTime() { return time; } @Override public void setTime(Date newTime) { this.time = newTime; }
  private String foodKind; @Override public String getFoodKind() { return foodKind; } @Override public void setFoodKind(String newFoodKind) { this.foodKind = newFoodKind; }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((id == null) ? 0 : id.hashCode());
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    FoodDTO other = (FoodDTO) obj;
    if (id == null) {
      if (other.id != null) {
        return false;
      }
    } else if (!id .equals(other.id)) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return getId() + "|" + getName() + "|" + String.valueOf(getKj());
  }
}
